import Log from '@src/util/log'

export default function catchError(msg: string = '') {
  return function (target: any, key: string, descriptor: PropertyDescriptor) {
    const fn = descriptor.value
    descriptor.value = function () {
      try {
        fn()
      } catch (error) {
        Log.error(error, fn.name)
      }
    }
  }
}